<template>
  <div id="app">
    <h2>测试题</h2>
    <subject>
      <SubjectItem v-for="(item, index) in subjectItems" :key="index" :num1="item.num1" :num2="item.num2"
        :result="item.result" :index="index"></SubjectItem>
    </subject>

    <div>
      <flag>
        <FlagItem v-for="(item, index) in subjectItems" :key="index" :status="item.status" :index="index"></FlagItem>
      </flag>
    </div>
  </div>

</template>

<script>

import SubjectItem from './components/SubjectItem.vue'
import FlagItem from './components/FlagItem.vue'
export default {
  name: 'App',
  components: {
    SubjectItem,
    FlagItem
  },
  data() {
    return {
      subjectItems: [
        { num1: Math.floor(Math.random() * 10), num2: Math.floor(Math.random() * 10), result: 0, status: '未完成' },
        { num1: Math.floor(Math.random() * 10), num2: Math.floor(Math.random() * 10), result: 0, status: '未完成' },
        { num1: Math.floor(Math.random() * 10), num2: Math.floor(Math.random() * 10), result: 0, status: '未完成' },
        { num1: Math.floor(Math.random() * 10), num2: Math.floor(Math.random() * 10), result: 0, status: '未完成' },
        { num1: Math.floor(Math.random() * 10), num2: Math.floor(Math.random() * 10), result: 0, status: '未完成' }
      ]
    };
  },
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>